package com.coda.service.impl;

import com.coda.entity.CityInfo;
import com.coda.entity.DistrictInfo;
import com.coda.entity.ProvinceInfo;
import com.coda.mapper.RegionInfoMapper;
import com.coda.service.RegionInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class RegionInfoServiceImpl implements RegionInfoService {

    @Autowired
    private RegionInfoMapper regionInfoMapper;
    /**
     * 查询省份信息列表
     * @return
     */
    @Override
    public List<ProvinceInfo> getProvinceList() {
        List<ProvinceInfo> provinceInfos = regionInfoMapper.getProvinceList();
        return provinceInfos;
    }

    /**
     * 根据省份id查询城市信息列表
     * @return
     */
    @Override
    public List<CityInfo> getCityList(Long id) {
        List<CityInfo> cityInfos = regionInfoMapper.getCityList(id);
        return cityInfos;
    }

    /**
     * 根据城市id查询区县信息
     * @param id
     * @return
     */
    @Override
    public List<DistrictInfo> getDistrict(Long id) {
        List<DistrictInfo> districtInfos = regionInfoMapper.getDistrictList(id);
        return districtInfos;
    }
}
